//
// CGraphController.h
// 

#ifndef __H_CGraphController__
#define __H_CGraphController__

#include "CVideoRendererFilter.h"
#include "CAudioRendererFilter.h"
#include "CMsgReceiver.h"

class CDXGraph;
class CDXFilter;
class CVideoWindow;
class CLiveCapture;
class CLiveInputFilters;
class CGraphController : public CMsgReceiver
{
protected:
	CDXGraph *          mGraph;
	CVideoWindow *      mVideoWindow;
	CLiveCapture *      mLiveCapture;
	BOOL                mIsGraphActive;

	CLiveInputFilters *     mInputFilters;
	CVideoRendererFilter *  mVideoRenderer;
	CAudioRendererFilter *  mAudioRenderer;

public:
	CGraphController();
	virtual ~CGraphController();

	void SetVideoWindow(CVideoWindow * inWindow);
	void SetLiveCapture(CLiveCapture * inData);
	CLiveInputFilters * GetInputFilters(void) { return mInputFilters;}
	virtual BOOL IsActiveDeviceLost(IUnknown * pLost);
	virtual BOOL SnapshotToFile(const char * inFile);

	BOOL Activate(void);
	void Deactive(void);
	virtual BOOL IsPAL(void);

	BOOL PlayGraph(void);
	BOOL PauseGraph(void);
	BOOL StopGraph(void);
	BOOL IsGraphActive(void);

	virtual bool ReceiveMessage(MessageT inMessage, void * ioParam,
		void * ioParam2);

protected:
	BOOL CreateGraph(void);
	void DeleteGraph(void);

	virtual BOOL ConnectFilters(void);
	virtual void DisconnectFilters(void);

	virtual BOOL CreateInputFilters(void);
	virtual void ReleaseInputFilters(void);
	virtual BOOL CreateOutputFilters(void);
	virtual void ReleaseOutputFilters(void);
};

#endif // __H_CGraphController__